using MethodChaining.MFComputer.Builders;
using MethodChaining.MFComputer.Model;

using NUnit.Framework;







/// <summary>
/// My version of what he does at http://www.martinfowler.com/dslwip/MethodChaining.html
/// </summary>
[TestFixture]
public class FowlersComputerExample_TheComputer
{
	/*
	   computer()
    .processor()
      .cores(2)
      .i386()
    .disk()
      .size(150)
    .disk()
      .size(75)
      .speed(7200)
      .sata()
    .end();
	 */



	private readonly Computer TheComputer = new ComputerBuilder()
		.WithCores( 2 )
		.OfType( Processor.i386 )
		.WithDisk
			.OfSize( 150 )
			.WithDisk
			.OfSize( 75 )
			.OfSpeed( 7200 )
			.IsSata
	                          ;





	[Test]
	public void ShouldHaveAn_I386Processor()
	{
		Assert.AreEqual( Processor.i386, TheComputer.Processor );
	}





	[Test]
	public void ShouldHave_2Cores()
	{
		Assert.AreEqual( 2, TheComputer.NumberOfCores );
	}





	[Test]
	public void ShouldHave_2Disks()
	{
		Assert.AreEqual( 2, TheComputer.Disks.Count );
	}





	[Test]
	public void ShouldHave_FirstDiskWith_SizeOf150()
	{
		Assert.AreEqual( 150, TheComputer.Disks[ 0 ].Size );
	}





	[Test]
	public void ShouldHave_FirstDiskThat_IsntSata()
	{
		Assert.IsFalse( TheComputer.Disks[ 0 ].Sata );
	}





	[Test]
	public void ShouldHave_SecondDiskWith_SizeOf75()
	{
		Assert.AreEqual( 75, TheComputer.Disks[ 1 ].Size );
	}





	[Test]
	public void ShouldHave_SecondDiskWith_SpeedOf7200()
	{
		Assert.AreEqual( 7200, TheComputer.Disks[ 1 ].Speed );
	}





	[Test]
	public void ShouldHave_SecondDiskThat_IsSata()
	{
		Assert.IsTrue( TheComputer.Disks[ 1 ].Sata );
	}
}